package org.jimthompson.delinkious;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Linker
{
	public Linker(Blog blog, MarkSource mark_source, Params params)
	{
        l_params = params;
		l_blog = blog;
        l_mark_source = mark_source;
    }
    
    public void makeLinkPost()
    {
		BlogPost p = l_blog.findMostRecentPostInCategory("", 20);
		System.out.println("Most recent post = " + p.getTitle());
		System.out.println("  date = " + p.getDate());
		
		@SuppressWarnings("unused") List<Mark> marks =
			l_mark_source.getDeliciousPostsAfter(l_params.p_delicious_username,
					l_params.p_delicious_password, p.getDate());

	}

	@SuppressWarnings("unchecked") void dumpMap(Map m) 
	{
		
		Set<Map.Entry<String, Object>> mset;
		mset = m.entrySet();
		
		Iterator<Map.Entry<String, Object>> iter = mset.iterator();
		while (iter.hasNext())
		{
			Map.Entry<String, Object> entry = iter.next();
			System.out.println("name = " + entry.getKey() + ", <" + entry.getValue() + ">");
		}
	}

	Params		l_params;
	Blog		l_blog;
    MarkSource  l_mark_source;
}
